package com.itheima.dubbo.mysql.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itheima.commons.model.domain.AdminLogin;
import com.itheima.dubbo.interfaces.SystemApi;
import com.itheima.dubbo.mysql.mapper.SystemMapper;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class SystemApiImpl implements SystemApi {
    @Autowired
    private SystemMapper systemMapper;


    /**
     * 根据账号和密码查询信息
     * @param username 账号
     * @param password  密码
     * @return
     */
    @Override
    public AdminLogin queryWithNameAndPsw(String username, String password) {
        return systemMapper.selectOne(Wrappers.lambdaQuery(AdminLogin.class).eq(AdminLogin::getUsername, username)
                .eq(AdminLogin::getPassword, password));
    }
}
